* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.chat-container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.chat-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.chat-header p {
    font-size: 14px;
    opacity: 0.9;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message {
    margin-bottom: 20px;
}

.user-message {
    text-align: right;
}

.user-message .message-content {
    background-color: #e1f5fe;
    border-radius: 18px 18px 4px 18px;
    display: inline-block;
    padding: 12px 16px;
    max-width: 80%;
    text-align: left;
}

.ai-message .message-content {
    background-color: #f5f5f5;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    max-width: 80%;
    border: 1px solid #e0e0e0;
}
    .ai-message .message-content div {
    margin-left:20px;
    }

.system-message {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 20px 0;
}

.message-content pre {
    background-color: #f8f8f8;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
}

.message-content code {
    font-family: 'Consolas', 'Monaco', monospace;
    background-color: #f8f8f8;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content img {
    max-width: 100%;
    border-radius: 8px;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}

.message-content th, .message-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.message-content th {
    background-color: #f2f2f2;
}

.chat-input-container {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background-color: #fafafa;
}

#userInput {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 10px;
    transition: border-color 0.3s;
}

#userInput:focus {
    outline: none;
    border-color: #667eea;
}

.input-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #5a67d8;
}

.btn-primary:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.typing-indicator {
    display: inline-block;
    padding: 12px 16px;
    background-color: #f5f5f5;
    border-radius: 18px 18px 18px 4px;
    max-width: 85%;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #666;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        margin: 0;
        height: 100vh;
        border-radius: 0;
    }
    
    .user-message .message-content,
    .ai-message .message-content {
        max-width: 90%;
    }
}